﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections;

namespace PhoneApp1
{
    public class RectangleCompare : IComparer
    {
        // maintain a reference to the 2-dimensional array being sorted
        private double[,] sortArray;

        // constructor initializes the sortArray reference
        public RectangleCompare(double[,] theArray)
        {
            sortArray = theArray;
        }

        public int Compare(object x, object y)
        {
            // x and y are integer row numbers into the sortArray
            int i1 = (int)x;
            int i2 = (int)y;

            // compare the items in the sortArray
            return sortArray[i1, 1].CompareTo(sortArray[i2, 1]);
        }
    }
}
